home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1996 #15
/
Monster Media Number 15 (Monster Media)(July 1996).ISO
/
prog_bas
/
t2win_32.zip
/
_FILE.FRM
< prev
next >
Wrap
Text File
|
1996-05-14
|
83KB
|
2,533 lines
VERSION 4.00
Begin VB.Form frmFile
BorderStyle = 4 'Fixed ToolWindow
Caption = "File"
ClientHeight = 5160
ClientLeft = 1485
ClientTop = 2415
ClientWidth = 7785
Height = 5565
Left = 1425
MaxButton = 0 'False
MDIChild = -1 'True
ScaleHeight = 5160
ScaleWidth = 7785
ShowInTaskbar = 0 'False
Top = 2070
Width = 7905
Begin VB.TextBox txt_Result
BackColor = &H00C0C0C0&
BorderStyle = 0 'None
Height = 4425
Left = 105
Locked = -1 'True
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 0
Top = 630
Width = 7575
End
Begin Threed.SSPanel SSPanel1
Align = 1 'Align Top
Height = 480
Left = 0
TabIndex = 1
Top = 0
Width = 7785
_Version = 65536
_ExtentX = 13732
_ExtentY = 847
_StockProps = 15
ForeColor = -2147483640
BackColor = 12632256
Begin VB.ComboBox cmb_Function
Height = 315
Left = 1365
TabIndex = 2
Top = 90
Width = 5100
End
Begin Threed.SSCommand cmdNP
Height = 300
Index = 1
Left = 7455
TabIndex = 6
Top = 90
Width = 255
_Version = 65536
_ExtentX = 450
_ExtentY = 529
_StockProps = 78
Caption = ">"
BevelWidth = 1
Font3D = 3
RoundedCorners = 0 'False
Outline = 0 'False
End
Begin Threed.SSCommand cmdNP
Height = 300
Index = 0
Left = 6615
TabIndex = 5
Top = 90
Width = 255
_Version = 65536
_ExtentX = 450
_ExtentY = 529
_StockProps = 78
Caption = "<"
BevelWidth = 1
Font3D = 3
RoundedCorners = 0 'False
Outline = 0 'False
End
Begin VB.Label Label2
Caption = "&Select a function"
Height = 255
Left = 90
TabIndex = 4
Top = 120
Width = 1275
End
Begin Threed.SSCommand SSCommand1
Default = -1 'True
Height = 300
Left = 6930
TabIndex = 3
Top = 90
Width = 465
_Version = 65536
_ExtentX = 820
_ExtentY = 529
_StockProps = 78
Caption = "&Go"
BevelWidth = 1
RoundedCorners = 0 'False
Outline = 0 'False
End
End
End
Attribute VB_Name = "frmFile"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Option Explicit
Option Base 1
Private Const Iteration = 10
Dim IsLoaded As Integer
Dim TimerStartOk As Integer
Dim TimerCloseOk As Integer
Dim TimerHandle As Integer
Dim TimerValue As Long
Private Sub cmdNP_Click(Index As Integer)
Call sub_NextPrev(cmb_Function, Index)
End Sub
Private Sub cmb_Function_Click()
If (IsLoaded = False) Then Exit Sub
Call cDisableFI(mdiT2W.Picture1)
txt_Result = ""
DoEvents
Select Case cmb_Function.ListIndex
Case 0
Call TestAllSubDirectories
Case 1
Call TestChDir
Case 2
Call TestChDrive
Case 3
Call TestFileCompressExpandTab
Case 4
Call TestFileCopy
Case 5
Call TestFileMove
Case 6
Call TestFileFilter
Case 7
Call TestFileFilterNot
Case 8
Call TestFileSize
Case 9
Call TestFileLineCount
Case 10
Call TestFileUpperLower
Case 11
Call TestFileMerge
Case 12
Call TestFileSearchAndReplace
Case 13
Call TestFileSearch
Case 14
Call TestFileSort(SORT_ASCENDING + SORT_CASE_SENSITIVE, False)
Case 15
Call TestFileSort(SORT_DESCENDING + SORT_CASE_SENSITIVE, False)
Case 16
Call TestFileSort(SORT_ASCENDING + SORT_CASE_INSENSITIVE, False)
Case 17
Call TestFileSort(SORT_DESCENDING + SORT_CASE_INSENSITIVE, False)
Case 18
Call TestFileSort(SORT_ASCENDING + SORT_CASE_SENSITIVE, True)
Case 19
Call TestFileSort(SORT_DESCENDING + SORT_CASE_SENSITIVE, True)
Case 20
Call TestFileSort(SORT_ASCENDING + SORT_CASE_INSENSITIVE, True)
Case 21
Call TestFileSort(SORT_DESCENDING + SORT_CASE_INSENSITIVE, True)
Case 22
Call TestFileChangeChars
Case 23
Call TestIsFileX
Case 24
Call TestKillDir
Case 25
Call TestKillDirs
Case 26
Call TestGetDiskSpace
Case 27
Call TestGetDiskUsed
Case 28
Call TestGetDiskFree
Case 29
Call TestGetDiskClusterSize
Case 30
Call TestCountFiles
Case 31
Call TestCountDirectories
Case 32
Call TestRcsCountFileDir
Case 33
Call TestFilesSizeX
Case 34
Call TestRcsFilesSizeX
Case 35
Call TestTruncatePath
Case 36
Call TestMakeSplitPath
Case 37
Call TestFullPath
Case 38
Call TestRenameFile
Case 39
Call TestUniqueFileName
Case 40
Call TestFilesInDirectory
Case 41
Call TestSubDirectory
Case 42
Call TestFileGetAttribute
Case 43
Call TestFileSetAttribute
Case 44
Call TestFileSetAllAttributes
Case 45
Call TestFileResetAllAttributes
Case 46
Call TestFileCompareX
Case 47
Call TestFileDrive
Case 48
Call TestFilesInDirOnDisk
Case 49
Call TestFileDateTime
Case 50
Call TestFileStatistics
Case 51
Call TestGetDriveType
Case 52
Call TestPBFileCopy
Case 53
Call TestDBFileCopy
Case 54
Call TestFileUUCP
End Select
DoEvents
Call cEnableFI(mdiT2W.Picture1)
End Sub
Private Sub Form_Activate()
mdiT2W.Label2.Caption = cInsertBlocks(mdiT2W.Label2.Tag, "" & Iteration)
End Sub
Private Sub Form_Load()
IsLoaded = False
Show
Call sub_Load_Combo(cmb_Function, T2WDirInst + "_file.t2w")
IsLoaded = True
End Sub
Private Sub SSCommand1_Click()
Call cmb_Function_Click
End Sub
Private Sub TestAllSubDirectories()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Long
strResult = ""
strDisplay = ""
i = -1
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
strResult = cAllSubDirectories("C:", i)
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
strResult = cStringSAR(strResult, vbCrLf, vbCrLf, False)
strDisplay = "Directories founden on drive C are " & i & vbCrLf & vbCrLf & strResult
txt_Result = strDisplay
End Sub
Private Sub TestChDir()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
strResult = ""
strDisplay = ""
For i = 1 To 26
intResult = cChDir(Chr$(64 + i) & ":\")
If (intResult = True) Then
strDisplay = strDisplay & "ChDir to \ on '" & Chr$(64 + i) & ":' is " & IIf(intResult = True, "succesfull", "not successfull") & vbCrLf
End If
Next i
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cChDir("C:\")
Next i
intResult = cChDir(T2WDirTest)
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestChDrive()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
strResult = ""
strDisplay = ""
For i = 1 To 26
intResult = cChDrive(Chr$(64 + i))
If (intResult = True) Then
strDisplay = strDisplay & "ChDrive on '" & Chr$(64 + i) & ":' is " & IIf(intResult = True, "succesfull", "not successfull") & vbCrLf
End If
Next i
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cChDrive("C")
Next i
intResult = cChDrive(T2WDirTest)
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileCompressExpandTab()
Dim lngResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim File1 As String
Dim File2 As String
Dim File3 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
File2 = "autoexec.tabcompressed"
File3 = "autoexec.tabexpanded"
For i = 1 To 4
strDisplay = strDisplay & "File CompressTab (" & i & " spaces = 1 tab) " & File1 & " to " & File2 & " is " & cFileCompressTab(File1, File2, i) & vbCrLf
strDisplay = strDisplay & "File ExpandTab (" & i & " spaces = 1 tab) " & File2 & " to " & File3 & " is " & cFileExpandTab(File2, File3, i) & vbCrLf
strDisplay = strDisplay & "Compare file contents (not sensitive) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
Next i
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lngResult = cFileExpandTab(File1, File2, 3)
Next i
lngResult = cFileCompressTab(File2, File3, 3)
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileCopy()
Dim lngResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim File1 As String
Dim File2 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
File2 = "autoexec.copy"
strDisplay = strDisplay & "File Copy '" & File1 & "' to '" & File2 & "' is " & cFileCopy(File1, File2) & vbCrLf & vbCrLf
strDisplay = strDisplay & "File Copy2 '" & File1 & "' to '" & File2 & "' is " & cFileCopy2(File1, File2) & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lngResult = cFileCopy(File1, File2)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileMove()
Dim lngResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim File1 As String
Dim File2 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
File2 = "c:\win95\autoexec.bat"
strDisplay = strDisplay & "File Move '" & File1 & "' to '" & File2 & "' is " & cFileMove(File1, File2) & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lngResult = cFileMove(File1, File2)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileFilter()
Dim lngResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim File1 As String
Dim File2 As String
Dim Filter As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
File2 = "autoexec.filter"
Filter = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Filter = Filter + LCase$(Filter)
strDisplay = strDisplay & "File Filter (A-Z, a-z) '" & File1 & "' to '" & File2 & "' is " & cFileFilter(File1, File2, Filter) & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lngResult = cFileFilter(File1, File2, Filter)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileFilterNot()
Dim lngResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim File1 As String
Dim File2 As String
Dim Filter As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
File2 = "autoexec.filternot"
Filter = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Filter = Filter + LCase$(Filter)
strDisplay = strDisplay & "File Filter Not (A-Z, a-z) '" & File1 & "' to '" & File2 & "' is " & cFileFilter(File1, File2, Filter) & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lngResult = cFileFilterNot(File1, File2, Filter)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileSize()
Dim lngResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim File1 As String
Dim File2 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
strDisplay = strDisplay & "File Size '" & File1 & "' is " & cFileSize(File1) & vbCrLf & vbCrLf
File1 = "c:\autoexec.bat"
strDisplay = strDisplay & "File Size '" & File1 & "' is " & cFileSize(File1) & vbCrLf & vbCrLf
File1 = "c:\config.sys"
strDisplay = strDisplay & "File Size '" & File1 & "' is " & cFileSize(File1) & vbCrLf & vbCrLf
File1 = "c:\test.tst"
strDisplay = strDisplay & "File Size '" & File1 & "' is " & cFileSize(File1) & vbCrLf & vbCrLf
File1 = "c:\command.com"
strDisplay = strDisplay & "File Size '" & File1 & "' is " & cFileSize(File1) & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lngResult = cFileSize(File1)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileLineCount()
Dim lngResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim File1 As String
Dim File2 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
strDisplay = strDisplay & "Total lines in '" & File1 & "' are " & cFileLineCount(File1) & vbCrLf & vbCrLf
File1 = "c:\autoexec.bat"
strDisplay = strDisplay & "Total lines in '" & File1 & "' are " & cFileLineCount(File1) & vbCrLf & vbCrLf
File1 = "c:\config.sys"
strDisplay = strDisplay & "Total lines in '" & File1 & "' are " & cFileLineCount(File1) & vbCrLf & vbCrLf
File1 = "c:\test.tst"
strDisplay = strDisplay & "Total lines in '" & File1 & "' are " & cFileLineCount(File1) & vbCrLf & vbCrLf
File1 = "c:\command.com"
strDisplay = strDisplay & "Total lines in '" & File1 & "' are " & cFileLineCount(File1) & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lngResult = cFileLineCount(File1)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Public Sub TestFileUpperLower()
Dim lngResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim File1 As String
Dim File2 As String
Dim File3 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
File2 = "autoexec.toupper"
File3 = "autoexec.tolower"
strDisplay = strDisplay & "File to upper '" & File1 & "' to '" & File2 & "' is " & cFileToUpper(File1, File2) & vbCrLf & vbCrLf
strDisplay = strDisplay & "File to lower '" & File1 & "' to '" & File3 & "' is " & cFileToLower(File1, File3) & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lngResult = cFileToUpper(File1, File2)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileMerge()
Dim lngResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim File1 As String
Dim File2 As String
Dim File3 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
File2 = "c:\config.sys"
File3 = "autoexec.merged"
strDisplay = strDisplay & "File Merge '" & File1 & "' and '" & File2 & "' to '" & File3 & "' is " & cFileMerge(File1, File2, File3) & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lngResult = cFileMerge(File1, File2, File3)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileSearchAndReplace()
Dim lngResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim File1 As String
Dim File2 As String
Dim Search As String
Dim Replace As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
File2 = "autoexec.searchandreplace"
Search = "rem SET "
Replace = "REM set "
strDisplay = strDisplay & "File Copy '" & File1 & "' to '" & File2 & "' is " & cFileCopy(File1, File2) & vbCrLf & vbCrLf
strDisplay = strDisplay & "File Search-Replace (sensitive) : '" & Search & "' -> '" & Replace & "' in '" & File2 & "' is " & cFileSearchAndReplace(File2, Search, Replace, "tmp.tmp", True) & vbCrLf & vbCrLf
strDisplay = strDisplay & "File Search-Replace (sensitive) : '" & Replace & "' -> '" & Search & "' in '" & File2 & "' is " & cFileSearchAndReplace(File2, Replace, Search, "tmp.tmp", True) & vbCrLf & vbCrLf
strDisplay = strDisplay & "Compare file contents (insensitive) '" & File2 & "' with '" & File1 & "' is " & IIf(cCmpFileContents(File2, File1, False) = True, "same", "not same") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
If ((i Mod 2) = 1) Then
lngResult = cFileSearchAndReplace(File1, Search, Replace, "", True)
Else
lngResult = cFileSearchAndReplace(File1, Search, Replace, "", True)
End If
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileSearch()
Dim lngResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim File1 As String
Dim Search1 As String
Dim Search2 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
Search1 = "re"
Search2 = "SET"
strDisplay = strDisplay & "File Search (insensitive) : '" & Search1 & "' in '" & File1 & "' is " & cFileSearch(File1, Search1, False) & vbCrLf & vbCrLf
strDisplay = strDisplay & "File Search and Count (insensitive) : '" & Search1 & "' in '" & File1 & "' is " & cFileSearchCount(File1, Search1, False) & vbCrLf & vbCrLf
strDisplay = strDisplay & "File Search (insensitive) : '" & Search2 & "' in '" & File1 & "' is " & cFileSearch(File1, Search2, False) & vbCrLf & vbCrLf
strDisplay = strDisplay & "File Search and Count (insensitive) : '" & Search2 & "' in '" & File1 & "' is " & cFileSearchCount(File1, Search2, False) & vbCrLf & vbCrLf
strDisplay = strDisplay & "File Search (sensitive) : '" & Search1 & "' in '" & File1 & "' is " & cFileSearch(File1, Search1, True) & vbCrLf & vbCrLf
strDisplay = strDisplay & "File Search and Count (sensitive) : '" & Search1 & "' in '" & File1 & "' is " & cFileSearchCount(File1, Search1, True) & vbCrLf & vbCrLf
strDisplay = strDisplay & "File Search (sensitive) : '" & Search2 & "' in '" & File1 & "' is " & cFileSearch(File1, Search2, True) & vbCrLf & vbCrLf
strDisplay = strDisplay & "File Search and Count (sensitive) : '" & Search2 & "' in '" & File1 & "' is " & cFileSearchCount(File1, Search2, True) & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
If ((i Mod 2) = 1) Then
lngResult = cFileSearch(File1, Search1, False)
Else
lngResult = cFileSearchCount(File1, Search2, False)
End If
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileSort(intSortMethod As Integer, intVarFix As Integer)
Dim lngResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim n As Long
Dim File1 As String
Dim File2 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
File2 = "autoexec.sort" & intSortMethod & Abs(intVarFix)
strDisplay = "The 7 first lines in '" & File1 & "' before sorting are " & vbCrLf & vbCrLf
Close #1
Open File1 For Input Shared As #1
For i = 1 To 7
Line Input #1, strResult
strDisplay = strDisplay + strResult + vbCrLf
Next i
Close #1
If (intVarFix = False) Then
lngResult = cFileSort(File1, File2, intSortMethod, -1, -1, -1, n)
Else
lngResult = cFileSort(File1, File2, intSortMethod, 7, 0, 7, n)
End If
strDisplay = strDisplay + vbCrLf
strDisplay = strDisplay + "The 7 first lines in '" & File2 & "' after sorting are " & vbCrLf & vbCrLf
Close #1
Open File2 For Input Shared As #1
For i = 1 To 7
Line Input #1, strResult
strDisplay = strDisplay + strResult + vbCrLf
Next i
Close #1
strDisplay = strDisplay + vbCrLf
Select Case intSortMethod
Case (SORT_ASCENDING + SORT_CASE_SENSITIVE):
strDisplay = strDisplay + "Sort '" & File1 & "' into '" & File2 & "' in ASC and CS is '" & lngResult & "' and records are '" & n & "'"
Case (SORT_DESCENDING + SORT_CASE_SENSITIVE):
strDisplay = strDisplay + "Sort '" & File1 & "' into '" & File2 & "' in DSC and CS is '" & lngResult & "' and records are '" & n & "'"
Case (SORT_ASCENDING + SORT_CASE_INSENSITIVE):
strDisplay = strDisplay + "Sort '" & File1 & "' into '" & File2 & "' in ASC and NS is '" & lngResult & "' and records are '" & n & "'"
Case (SORT_DESCENDING + SORT_CASE_INSENSITIVE):
strDisplay = strDisplay + "Sort '" & File1 & "' into '" & File2 & "' in DSC and NS is '" & lngResult & "' and records are '" & n & "'"
End Select
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lngResult = cFileSort(File1, File2, intSortMethod, -1, -1, -1, n)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileChangeChars()
Dim lngResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim File1 As String
Dim File2 As String
Dim Change1 As String
Dim Change2 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
File2 = "autoexec.changechars"
Change1 = "REM"
Change2 = "mer"
txt_Result = strDisplay
strDisplay = strDisplay & "File Copy '" & File1 & "' to '" & File2 & "' is " & cFileCopy(File1, File2) & vbCrLf & vbCrLf
strDisplay = strDisplay & "The 7 first lines in '" & File2 & "' before change are " & vbCrLf & vbCrLf
Close #1
Open File2 For Input Shared As #1
For i = 1 To 7
Line Input #1, strResult
strDisplay = strDisplay + strResult + vbCrLf
Next i
Close #1
strDisplay = strDisplay + vbCrLf
strDisplay = strDisplay & "File Change Chars : '" & Change1 & "' -> '" & Change2 & "' in '" & File2 & "' is " & cFileChangeChars(File2, Change1, Change2, "file1.file1") & vbCrLf & vbCrLf
strDisplay = strDisplay & "The 7 first lines in '" & File2 & "' after change are " & vbCrLf & vbCrLf
Close #1
Open File2 For Input Shared As #1
For i = 1 To 7
Line Input #1, strResult
strDisplay = strDisplay + strResult + vbCrLf
Next i
Close #1
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
If ((i Mod 2) = 1) Then
lngResult = cFileChangeChars(File2, Change1, Change2, "")
Else
lngResult = cFileChangeChars(File2, Change2, Change1, "")
End If
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestIsFileX()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
strDisplay = strDisplay & "File '" & File1 & "' is " & vbCrLf & vbCrLf
strDisplay = strDisplay & IIf(cIsFilenameValid(File1), " a good filename", " is not a good filename") & vbCrLf
strDisplay = strDisplay & IIf(cIsFileArchive(File1), " archive", " not archive") & vbCrLf
strDisplay = strDisplay & IIf(cIsFileHidden(File1), " hidden", " not hidden") & vbCrLf
strDisplay = strDisplay & IIf(cIsFileNormal(File1), " normal", " not normal") & vbCrLf
strDisplay = strDisplay & IIf(cIsFileReadOnly(File1), " read-only", " not read-only") & vbCrLf
strDisplay = strDisplay & IIf(cIsFileSubDir(File1), " sub-directory", " not sub-directory") & vbCrLf
strDisplay = strDisplay & IIf(cIsFileSystem(File1), " system", " not system") & vbCrLf
strDisplay = strDisplay & IIf(cIsFileCompressed(File1), " compressed", " not compressed") & vbCrLf & vbCrLf
File1 = cGetWindowsDirectory() & "\user.dat"
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "' is " & vbCrLf & vbCrLf
strDisplay = strDisplay & IIf(cIsFilenameValid(File1), " a good filename", " is not a good filename") & vbCrLf
strDisplay = strDisplay & IIf(cIsFileArchive(File1), " archive", " not archive") & vbCrLf
strDisplay = strDisplay & IIf(cIsFileHidden(File1), " hidden", " not hidden") & vbCrLf
strDisplay = strDisplay & IIf(cIsFileNormal(File1), " normal", " not normal") & vbCrLf
strDisplay = strDisplay & IIf(cIsFileReadOnly(File1), " read-only", " not read-only") & vbCrLf
strDisplay = strDisplay & IIf(cIsFileSubDir(File1), " sub-directory", " not sub-directory") & vbCrLf
strDisplay = strDisplay & IIf(cIsFileSystem(File1), " system", " not system") & vbCrLf
strDisplay = strDisplay & IIf(cIsFileCompressed(File1), " compressed", " not compressed") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cIsFilenameValid(File1)
Next i
intResult = cChDir(T2WDirTest)
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestKillDir()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
strResult = ""
strDisplay = ""
File1 = "c:\this is a test for KillDir"
intResult = cMakeDir(File1)
strDisplay = strDisplay & "Directory '" & File1 & "' is created" & vbCrLf & vbCrLf
strDisplay = strDisplay & "Directory '" & File1 & "' is " & IIf(cKillDir(File1) = True, "deleted", "not deleted") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cKillDir(File1)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestKillDirs()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
strResult = ""
strDisplay = ""
File1 = "c:\this1\this2\this3\this4"
intResult = cMakeMultipleDir(File1)
strDisplay = strDisplay & "Directories '" & File1 & "' are created" & vbCrLf & vbCrLf
strDisplay = strDisplay & "Directories '" & File1 & "' are " & IIf(cKillDirs("c:\this1", True) > 0, "deleted", "not deleted") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cKillDirs(File1, True)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestGetDiskSpace()
Dim lngResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
strResult = ""
strDisplay = ""
For i = 1 To 26
lngResult = cGetDiskSpace(Chr$(64 + i))
If (lngResult <> True) Then
strDisplay = strDisplay & "DiskSpace for '" & Chr$(64 + i) & ":' is " & lngResult & vbCrLf
End If
Next i
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lngResult = cGetDiskSpace("C")
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestGetDiskUsed()
Dim lngResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
strResult = ""
strDisplay = ""
For i = 1 To 26
lngResult = cGetDiskUsed(Chr$(64 + i))
If (lngResult <> True) Then
strDisplay = strDisplay & "DiskSpace for '" & Chr$(64 + i) & ":' is " & lngResult & vbCrLf
End If
Next i
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lngResult = cGetDiskUsed("C")
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestGetDiskFree()
Dim lngResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
strResult = ""
strDisplay = ""
For i = 1 To 26
lngResult = cGetDiskFree(Chr$(64 + i))
If (lngResult <> True) Then
strDisplay = strDisplay & "DiskSpace for '" & Chr$(64 + i) & ":' is " & lngResult & vbCrLf
End If
Next i
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lngResult = cGetDiskFree("C")
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestGetDiskClusterSize()
Dim lngResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
strResult = ""
strDisplay = ""
For i = 1 To 26
lngResult = cGetDiskClusterSize(Chr$(64 + i))
If (lngResult <> True) Then
strDisplay = strDisplay & "DiskSpace for '" & Chr$(64 + i) & ":' is " & lngResult & vbCrLf
End If
Next i
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lngResult = cGetDiskClusterSize("C")
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestRcsCountFileDir()
Dim lngResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
strResult = ""
strDisplay = ""
strDisplay = strDisplay & "Total directories in C: is " & cRcsCountFileDir(False, "C:", "", True) & vbCrLf
strDisplay = strDisplay & "Total directories in D: is " & cRcsCountFileDir(False, "D:", "", True) & vbCrLf
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "Total files in C: is " & cRcsCountFileDir(True, "C:", "", True) & vbCrLf
strDisplay = strDisplay & "Total files in D: is " & cRcsCountFileDir(True, "D:", "", True) & vbCrLf
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "Total files in C:*.DAT is " & cRcsCountFileDir(True, "C:", "*.DAT", True) & vbCrLf
strDisplay = strDisplay & "Total files in D:*.DAT is " & cRcsCountFileDir(True, "D:", "*.DAT", True) & vbCrLf
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "Total directories in C:\ is " & cRcsCountFileDir(False, "C:", "", False) & vbCrLf
strDisplay = strDisplay & "Total directories in D:\ is " & cRcsCountFileDir(False, "D:", "", False) & vbCrLf
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "Total files in C:\ is " & cRcsCountFileDir(True, "C:", "", False) & vbCrLf
strDisplay = strDisplay & "Total files in D:\ is " & cRcsCountFileDir(True, "D:", "", False) & vbCrLf
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "Total files in C:\*.DAT is " & cRcsCountFileDir(True, "C:", "*.DAT", False) & vbCrLf
strDisplay = strDisplay & "Total files in D:\*.DAT is " & cRcsCountFileDir(True, "D:", "*.DAT", False) & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lngResult = cRcsCountFileDir(False, "C:", "", False)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestCountFiles()
Dim lngResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
strResult = ""
strDisplay = ""
strDisplay = strDisplay & "Number of files in C:\ is " & cCountFiles("C:\*.*") & vbCrLf & vbCrLf
strDisplay = strDisplay & "Number of files in D:\ is " & cCountFiles("D:\*.*") & vbCrLf & vbCrLf
strDisplay = strDisplay & "Number of files in E:\ is " & cCountFiles("E:\*.*") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lngResult = cCountFiles("C:\*.*")
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestCountDirectories()
Dim lngResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
strResult = ""
strDisplay = ""
strDisplay = strDisplay & "Number of directories in C:\ is " & cCountDirectories("C:\*.*") & vbCrLf & vbCrLf
strDisplay = strDisplay & "Number of directories in D:\ is " & cCountDirectories("D:\*.*") & vbCrLf & vbCrLf
strDisplay = strDisplay & "Number of directories in E:\ is " & cCountDirectories("E:\*.*") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lngResult = cCountDirectories("C:\*.*")
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFilesSizeX()
Dim lngResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim Size1 As Long
Dim Size2 As Long
strResult = ""
strDisplay = ""
strDisplay = strDisplay & "Size of files c:\*.* is " & cFilesSize("c:\*.*") & vbCrLf
strDisplay = strDisplay & "Size of files c:\*.bat is " & cFilesSize("c:\*.bat") & vbCrLf
strDisplay = strDisplay & "Size of files c:\*.sys is " & cFilesSize("c:\*.sys") & vbCrLf
strDisplay = strDisplay & "Size of files c:\*.com is " & cFilesSize("c:\*.com") & vbCrLf
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "Size of files c:\*.* on disk is " & cFilesSizeOnDisk("c:\*.*") & vbCrLf
strDisplay = strDisplay & "Size of files c:\*.bat on disk is " & cFilesSizeOnDisk("c:\*.bat") & vbCrLf
strDisplay = strDisplay & "Size of files c:\*.sys on disk is " & cFilesSizeOnDisk("c:\*.sys") & vbCrLf
strDisplay = strDisplay & "Size of files c:\*.com on disk is " & cFilesSizeOnDisk("c:\*.com") & vbCrLf
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "Slack of files c:\*.* on disk is " & cFilesSlack("c:\*.*", Size1, Size2) & " %" & vbCrLf
strDisplay = strDisplay & "Slack of files c:\*.bat on disk is " & cFilesSlack("c:\*.bat", Size1, Size2) & " %" & vbCrLf
strDisplay = strDisplay & "Slack of files c:\*.sys on disk is " & cFilesSlack("c:\*.sys", Size1, Size2) & " %" & vbCrLf
strDisplay = strDisplay & "Slack of files c:\*.com on disk is " & cFilesSlack("c:\*.com", Size1, Size2) & " %" & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lngResult = cFilesSize("c:\*.*")
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestRcsFilesSizeX()
Dim lngResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim Size1 As Long
Dim Size2 As Long
strResult = ""
strDisplay = ""
strDisplay = strDisplay & "Size of files c:\*.* is " & cRcsFilesSize("c:\", "*.*", False) & vbCrLf
strDisplay = strDisplay & "Size of files c:\*.exe is " & cRcsFilesSize("c:\", "*.exe", False) & vbCrLf
strDisplay = strDisplay & "Size of files c:\*.com is " & cRcsFilesSize("c:\", "*.com", False) & vbCrLf
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "Size of files c:\*.* on disk is " & cRcsFilesSizeOnDisk("c:\", "*.*", False) & vbCrLf
strDisplay = strDisplay & "Size of files c:\*.exe on disk is " & cRcsFilesSizeOnDisk("c:\", "*.exe", False) & vbCrLf
strDisplay = strDisplay & "Size of files c:\*.com on disk is " & cRcsFilesSizeOnDisk("c:\", "*.com", False) & vbCrLf
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "Slack of files c:\*.* on disk is " & cRcsFilesSlack("c:\", "*.*", False, Size1, Size2) & " %" & vbCrLf
strDisplay = strDisplay & "Slack of files c:\*.exe on disk is " & cRcsFilesSlack("c:\", "*.exe", False, Size1, Size2) & " %" & vbCrLf
strDisplay = strDisplay & "Slack of files c:\*.com on disk is " & cRcsFilesSlack("c:\", "*.com", False, Size1, Size2) & " %" & vbCrLf
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "Size of files c:\*.* is " & cRcsFilesSize("c:\", "*.*", True) & vbCrLf
strDisplay = strDisplay & "Size of files c:\*.exe is " & cRcsFilesSize("c:\", "*.exe", True) & vbCrLf
strDisplay = strDisplay & "Size of files c:\*.com is " & cRcsFilesSize("c:\", "*.com", True) & vbCrLf
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "Size of files c:\*.* on disk is " & cRcsFilesSizeOnDisk("c:\", "*.*", True) & vbCrLf
strDisplay = strDisplay & "Size of files c:\*.exe on disk is " & cRcsFilesSizeOnDisk("c:\", "*.exe", True) & vbCrLf
strDisplay = strDisplay & "Size of files c:\*.com on disk is " & cRcsFilesSizeOnDisk("c:\", "*.com", True) & vbCrLf
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "Slack of files c:\*.* on disk is " & cRcsFilesSlack("c:\", "*.*", True, Size1, Size2) & " %" & vbCrLf
strDisplay = strDisplay & "Slack of files c:\*.exe on disk is " & cRcsFilesSlack("c:\", "*.exe", True, Size1, Size2) & " %" & vbCrLf
strDisplay = strDisplay & "Slack of files c:\*.com on disk is " & cRcsFilesSlack("c:\", "*.com", True, Size1, Size2) & " %" & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lngResult = cRcsFilesSize("c:\", "*.*", False)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestTruncatePath()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
strResult = ""
strDisplay = ""
strDisplay = strDisplay & "Truncate the following path with a length of 25" & vbCrLf & vbCrLf
File1 = "t2win-16.bas"
strResult = cTruncatePath(File1, 25)
strDisplay = strDisplay & File1 & vbCrLf & " -> " & strResult & " (len=" & Len(strResult) & ")" & vbCrLf
File1 = "windows\system\t2win-16.bas"
strResult = cTruncatePath(File1, 25)
strDisplay = strDisplay & File1 & vbCrLf & " -> " & strResult & " (len=" & Len(strResult) & ")" & vbCrLf
File1 = "c:\win95\system\t2win-16.bas"
strResult = cTruncatePath(File1, 25)
strDisplay = strDisplay & File1 & vbCrLf & " -> " & strResult & " (len=" & Len(strResult) & ")" & vbCrLf
File1 = "c:\win95\system\visual\t2win-16\t2win-16.bas"
strResult = cTruncatePath(File1, 25)
strDisplay = strDisplay & File1 & vbCrLf & " -> " & strResult & " (len=" & Len(strResult) & ")" & vbCrLf
File1 = "c:\win95\system\visual\source\t2win-16\t2win-16.bas"
strResult = cTruncatePath(File1, 25)
strDisplay = strDisplay & File1 & vbCrLf & " -> " & strResult & " (len=" & Len(strResult) & ")" & vbCrLf & vbCrLf
strDisplay = strDisplay & "Truncate the following path with a length of 35" & vbCrLf & vbCrLf
File1 = "t2win-16.bas"
strResult = cTruncatePath(File1, 35)
strDisplay = strDisplay & File1 & vbCrLf & " -> " & strResult & " (len=" & Len(strResult) & ")" & vbCrLf
File1 = "windows\system\t2win-16.bas"
strResult = cTruncatePath(File1, 35)
strDisplay = strDisplay & File1 & vbCrLf & " -> " & strResult & " (len=" & Len(strResult) & ")" & vbCrLf
File1 = "c:\win95\system\t2win-16.bas"
strResult = cTruncatePath(File1, 35)
strDisplay = strDisplay & File1 & vbCrLf & " -> " & strResult & " (len=" & Len(strResult) & ")" & vbCrLf
File1 = "c:\win95\system\visual\t2win-16\t2win-16.bas"
strResult = cTruncatePath(File1, 35)
strDisplay = strDisplay & File1 & vbCrLf & " -> " & strResult & " (len=" & Len(strResult) & ")" & vbCrLf
File1 = "c:\win95\system\visual\source\t2win-16\t2win-16.bas"
strResult = cTruncatePath(File1, 35)
strDisplay = strDisplay & File1 & vbCrLf & " -> " & strResult & " (len=" & Len(strResult) & ")" & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
strResult = cTruncatePath(File1, 35)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestMakeSplitPath()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim SPLITPATH As tagSPLITPATH
Dim File1 As String
strResult = ""
strDisplay = ""
File1 = cMakePath("c", "\this is a test", "test", "dat")
strDisplay = strDisplay & "Make Path of (c,\this is a test,test,dat) is '" & File1 & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay & "Split Path '" & File1 & "' into four components is :" & vbCrLf & vbCrLf
intResult = cSplitPath(File1, SPLITPATH)
strDisplay = strDisplay & Space$(3) & SPLITPATH.nDrive & vbCrLf
strDisplay = strDisplay & Space$(3) & SPLITPATH.nDir & vbCrLf
strDisplay = strDisplay & Space$(3) & SPLITPATH.nName & vbCrLf
strDisplay = strDisplay & Space$(3) & SPLITPATH.nExt & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
strResult = cMakePath("c", "this is a test", "test", "dat")
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFullPath()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
strDisplay = strDisplay & "Full Path of " & File1 & " is " & cFullPath(File1) & vbCrLf & vbCrLf
File1 = cGetSystemDirectory() & "\t2win-32.dll"
strDisplay = strDisplay & "Full Path of " & File1 & " is " & cFullPath(File1) & vbCrLf & vbCrLf
File1 = cFilesInDirectory(cGetDefaultCurrentDir() + "\*.*", True)
strDisplay = strDisplay & "Full Path of " & File1 & " is " & cFullPath(File1) & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
strResult = cFullPath(File1)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestRenameFile()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
Dim File2 As String
strResult = ""
strDisplay = ""
File1 = "this.is.a.test.~~~"
File2 = "an another test.---"
intResult = cKillFile(File1)
intResult = cKillFile(File2)
Close #1
Open File1 For Output Shared As #1
Print #1, File1
Print #1, File2
Close #1
strDisplay = "File '" & File1 & "' " & IIf(cRenameFile(File1, File2) = True, "renamed in '" & File2 & "'", "is not renamed") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cRenameFile(File1, File2)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Public Sub TestUniqueFileName()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
strResult = ""
strDisplay = ""
File1 = "WN"
strDisplay = strDisplay + "Generate unique filename with template '" & File1 & "' is '" & cUniqueFileName(File1) & "'" & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
strResult = cUniqueFileName(File1)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFilesInDirectory()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
strResult = ""
strDisplay = ""
File1 = "*.*"
strDisplay = strDisplay + "The 10 first files in the current directory '" & cGetDriveCurrentDir("C") & "'" & vbCrLf & vbCrLf
strResult = cFilesInDirectory(File1, True)
For i = 1 To 10
strDisplay = strDisplay & strResult & vbCrLf
strResult = cFilesInDirectory(File1, False)
Next i
strDisplay = strDisplay + vbCrLf
File1 = "C:\*.*"
strDisplay = strDisplay + "The 10 first files in '" & File1 & "'" & vbCrLf & vbCrLf
strResult = cFilesInDirectory(File1, True)
For i = 1 To 10
strDisplay = strDisplay & strResult & vbCrLf
strResult = cFilesInDirectory(File1, False)
Next i
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
strResult = cFilesInDirectory(File1, True)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestSubDirectory()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
strResult = ""
strDisplay = ""
File1 = "*.*"
strDisplay = strDisplay + "The 10 first directory in the current directory '" & cGetDriveCurrentDir("C") & "'" & vbCrLf & vbCrLf
strResult = cSubDirectory(File1, True)
For i = 1 To 10
strDisplay = strDisplay & strResult & vbCrLf
strResult = cSubDirectory(File1, False)
Next i
strDisplay = strDisplay + vbCrLf
File1 = "C:\*.*"
strDisplay = strDisplay + "The 10 first directory in '" & File1 & "'" & vbCrLf & vbCrLf
strResult = cSubDirectory(File1, True)
For i = 1 To 10
strDisplay = strDisplay & strResult & vbCrLf
strResult = cSubDirectory(File1, False)
Next i
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
strResult = cSubDirectory(File1, True)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileGetAttribute()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
Dim FileAttrib As FileAttributeType
strResult = ""
strDisplay = ""
File1 = cFilesInDirectory("*.*", True)
intResult = cFileGetAttrib(File1, FileAttrib)
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Archive, " is Archive", " is not Archive") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Hidden, " is Hidden", " is not Hidden") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Normal, " is Normal", " is not Normal") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.ReadOnly, " is ReadOnly", " is not ReadOnly") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.SubDir, " is SubDir", " is not SubDir") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.System, " is System", " is not System") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Compressed, " is Compressed", " is not Compressed") & vbCrLf & vbCrLf
File1 = cGetWindowsDirectory() & "\user.dat"
intResult = cFileGetAttrib(File1, FileAttrib)
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Archive, " is Archive", " is not Archive") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Hidden, " is Hidden", " is not Hidden") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Normal, " is Normal", " is not Normal") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.ReadOnly, " is ReadOnly", " is not ReadOnly") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.SubDir, " is SubDir", " is not SubDir") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.System, " is System", " is not System") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Compressed, " is Compressed", " is not Compressed") & vbCrLf & vbCrLf
File1 = cSubDirectory("c:\*.*", True)
File1 = cSubDirectory("c:\*.*", False)
File1 = cSubDirectory("c:\*.*", False)
File1 = "c:\" & File1
intResult = cFileGetAttrib(File1, FileAttrib)
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Archive, " is Archive", " is not Archive") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Hidden, " is Hidden", " is not Hidden") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Normal, " is Normal", " is not Normal") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.ReadOnly, " is ReadOnly", " is not ReadOnly") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.SubDir, " is SubDir", " is not SubDir") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.System, " is System", " is not System") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Compressed, " is Compressed", " is not Compressed") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cFileGetAttrib(File1, FileAttrib)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileSetAttribute()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
Dim FileAttrib As FileAttributeType
strResult = ""
strDisplay = ""
File1 = cFilesInDirectory("*.*", True)
intResult = cFileGetAttrib(File1, FileAttrib)
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Archive, " is Archive", " is not Archive") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Hidden, " is Hidden", " is not Hidden") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Normal, " is Normal", " is not Normal") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.ReadOnly, " is ReadOnly", " is not ReadOnly") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.SubDir, " is SubDir", " is not SubDir") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.System, " is System", " is not System") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Compressed, " is Compressed", " is not Compressed") & vbCrLf & vbCrLf
FileAttrib.Archive = False
FileAttrib.Hidden = True
FileAttrib.ReadOnly = True
FileAttrib.System = True
intResult = cFileSetAttrib(File1, FileAttrib)
strDisplay = strDisplay & "Setting attribute (not archive, hidden, readonly, system) to file '" & File1 & "' is " & intResult & vbCrLf & vbCrLf
intResult = cFileGetAttrib(File1, FileAttrib)
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Archive, " is Archive", " is not Archive") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Hidden, " is Hidden", " is not Hidden") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Normal, " is Normal", " is not Normal") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.ReadOnly, " is ReadOnly", " is not ReadOnly") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.SubDir, " is SubDir", " is not SubDir") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.System, " is System", " is not System") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Compressed, " is Compressed", " is not Compressed") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cFileSetAttrib(File1, FileAttrib)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileSetAllAttributes()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
Dim FileAttrib As FileAttributeType
strResult = ""
strDisplay = ""
File1 = cFilesInDirectory("*.*", True)
intResult = cFileGetAttrib(File1, FileAttrib)
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Archive, " is Archive", " is not Archive") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Hidden, " is Hidden", " is not Hidden") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Normal, " is Normal", " is not Normal") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.ReadOnly, " is ReadOnly", " is not ReadOnly") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.SubDir, " is SubDir", " is not SubDir") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.System, " is System", " is not System") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Compressed, " is Compressed", " is not Compressed") & vbCrLf & vbCrLf
intResult = cFileSetAllAttrib(File1)
strDisplay = strDisplay & "Resetting all attributes (except normal, compressed) to file '" & File1 & "' is " & intResult & vbCrLf & vbCrLf
intResult = cFileGetAttrib(File1, FileAttrib)
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Archive, " is Archive", " is not Archive") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Hidden, " is Hidden", " is not Hidden") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Normal, " is Normal", " is not Normal") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.ReadOnly, " is ReadOnly", " is not ReadOnly") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.SubDir, " is SubDir", " is not SubDir") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.System, " is System", " is not System") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Compressed, " is Compressed", " is not Compressed") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cFileSetAllAttrib(File1)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Public Sub TestFileResetAllAttributes()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
Dim FileAttrib As FileAttributeType
strResult = ""
strDisplay = ""
File1 = cFilesInDirectory("*.*", True)
intResult = cFileGetAttrib(File1, FileAttrib)
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Archive, " is Archive", " is not Archive") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Hidden, " is Hidden", " is not Hidden") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Normal, " is Normal", " is not Normal") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.ReadOnly, " is ReadOnly", " is not ReadOnly") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.SubDir, " is SubDir", " is not SubDir") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.System, " is System", " is not System") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Compressed, " is Compressed", " is not Compressed") & vbCrLf & vbCrLf
intResult = cFileResetAllAttrib(File1)
strDisplay = strDisplay & "Resetting all attributes (except normal, compressed) to file '" & File1 & "' is " & intResult & vbCrLf & vbCrLf
intResult = cFileGetAttrib(File1, FileAttrib)
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Archive, " is Archive", " is not Archive") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Hidden, " is Hidden", " is not Hidden") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Normal, " is Normal", " is not Normal") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.ReadOnly, " is ReadOnly", " is not ReadOnly") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.SubDir, " is SubDir", " is not SubDir") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.System, " is System", " is not System") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Compressed, " is Compressed", " is not Compressed") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cFileResetAllAttrib(File1)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Public Sub TestFileCompareX()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
Dim File2 As String
Dim FileAttrib As FileAttributeType
strResult = ""
strDisplay = ""
File1 = T2WFileTest
File2 = "autoexec.compare"
strDisplay = strDisplay & "File Copy '" & File1 & "' to '" & File2 & "' is " & cFileCopy(File1, File2) & vbCrLf & vbCrLf
strDisplay = strDisplay & "Compare file attribute '" & File1 & "' with '" & File2 & "' is " & cCmpFileAttribute(File1, File2) & vbCrLf
strDisplay = strDisplay & "Compare file size '" & File1 & "' with '" & File2 & "' is " & cCmpFileSize(File1, File2) & vbCrLf
strDisplay = strDisplay & "Compare file time '" & File1 & "' with '" & File2 & "' is " & cCmpFileTime(File1, File2) & vbCrLf
strDisplay = strDisplay & "Compare file contents (case sensitive) '" & File1 & "' with '" & File2 & "' is " & cCmpFileContents(File1, File2, True) & vbCrLf
strDisplay = strDisplay & "Compare file contents (not sensitive) '" & File1 & "' with '" & File2 & "' is " & cCmpFileContents(File1, File2, False) & vbCrLf & vbCrLf
Close #1
Open File2 For Append Shared As #1
Print #1, File2
Close #1
strDisplay = strDisplay & "Appending " & (Len(File2) + 2) & " chars to '" & File2 & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay & "Compare file attribute '" & File1 & "' with '" & File2 & "' is " & cCmpFileAttribute(File1, File2) & vbCrLf
strDisplay = strDisplay & "Compare file size '" & File1 & "' with '" & File2 & "' is " & cCmpFileSize(File1, File2) & vbCrLf
strDisplay = strDisplay & "Compare file time '" & File1 & "' with '" & File2 & "' is " & cCmpFileTime(File1, File2) & vbCrLf
strDisplay = strDisplay & "Compare file contents (case sensitive) '" & File1 & "' with '" & File2 & "' is " & cCmpFileContents(File1, File2, True) & vbCrLf
strDisplay = strDisplay & "Compare file contents (not sensitive) '" & File1 & "' with '" & File2 & "' is " & cCmpFileContents(File1, File2, False) & vbCrLf & vbCrLf
strDisplay = strDisplay & "Resetting all attributes (except normal, compressed) is " & cFileResetAllAttrib(File2) & vbCrLf & vbCrLf
strDisplay = strDisplay & "Compare file attribute '" & File1 & "' with '" & File2 & "' is " & cCmpFileAttribute(File1, File2) & vbCrLf
strDisplay = strDisplay & "Compare file size '" & File1 & "' with '" & File2 & "' is " & cCmpFileSize(File1, File2) & vbCrLf
strDisplay = strDisplay & "Compare file time '" & File1 & "' with '" & File2 & "' is " & cCmpFileTime(File1, File2) & vbCrLf
strDisplay = strDisplay & "Compare file contents (case sensitive) '" & File1 & "' with '" & File2 & "' is " & cCmpFileContents(File1, File2, True) & vbCrLf
strDisplay = strDisplay & "Compare file contents (not sensitive) '" & File1 & "' with '" & File2 & "' is " & cCmpFileContents(File1, File2, False) & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cCmpFileSize(File1, File2)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileDrive()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
strDisplay = strDisplay & "File drive of '" & File1 & "' is " & cFileDrive(File1) & vbCrLf & vbCrLf
File1 = cGetWindowsDirectory() + "\user.dat"
strDisplay = strDisplay & "File drive of '" & File1 & "' is " & cFileDrive(File1) & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
strResult = cFileDrive(File1)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFilesInDirOnDisk()
Dim lngResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
Dim File2 As String
strResult = ""
strDisplay = ""
File1 = "filesindirondisk.temp"
File2 = "c:\*.*"
strDisplay = strDisplay & "Number of files '" & File2 & "' (with at least one of the following attribute)" & vbCrLf & vbCrLf
strDisplay = strDisplay & "Any : " & cFilesInDirOnDisk(File1, File2, A_ALL) & vbCrLf
strDisplay = strDisplay & "(N)ormal : " & cFilesInDirOnDisk(File1, File2, A_NORMAL) & vbCrLf
strDisplay = strDisplay & "(A)rchive, (N)ormal : " & cFilesInDirOnDisk(File1, File2, A_NORMAL_ARCHIVE) & vbCrLf
strDisplay = strDisplay & "(A)rchive : " & cFilesInDirOnDisk(File1, File2, A_ARCHIVE) & vbCrLf
strDisplay = strDisplay & "(A)rchive, (R)ead-Only : " & cFilesInDirOnDisk(File1, File2, A_ARCHIVE Or A_RDONLY) & vbCrLf
strDisplay = strDisplay & "(S)ystem, (H)idden, (R)ead-Only : " & cFilesInDirOnDisk(File1, File2, A_SYSTEM Or A_HIDDEN Or A_RDONLY) & vbCrLf
strDisplay = strDisplay & "(H)idden, (R)ead-Only : " & cFilesInDirOnDisk(File1, File2, A_HIDDEN Or A_RDONLY) & vbCrLf
strDisplay = strDisplay & "(R)ead-Only : " & cFilesInDirOnDisk(File1, File2, A_RDONLY) & vbCrLf
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "Number of files in '" & File2 & "' (with exact attribute excluding all others)" & vbCrLf & vbCrLf
strDisplay = strDisplay & "(N)ormal : " & cFilesInDirOnDisk(File1, File2, -(A_NORMAL)) & vbCrLf
strDisplay = strDisplay & "(A)rchive, (N)ormal : " & cFilesInDirOnDisk(File1, File2, -(A_NORMAL_ARCHIVE)) & vbCrLf
strDisplay = strDisplay & "(A)rchive : " & cFilesInDirOnDisk(File1, File2, -(A_ARCHIVE)) & vbCrLf
strDisplay = strDisplay & "(A)rchive, (R)ead-Only : " & cFilesInDirOnDisk(File1, File2, -(A_ARCHIVE Or A_RDONLY)) & vbCrLf
strDisplay = strDisplay & "(S)ystem, (H)idden, (R)ead-Only : " & cFilesInDirOnDisk(File1, File2, -(A_SYSTEM Or A_HIDDEN Or A_RDONLY)) & vbCrLf
strDisplay = strDisplay & "(A)rchive, (S)ystem, (H)idden, (R)ead-Only : " & cFilesInDirOnDisk(File1, File2, -(A_NORMAL Or A_SYSTEM Or A_HIDDEN Or A_RDONLY)) & vbCrLf
strDisplay = strDisplay & "(H)idden, (R)ead-Only : " & cFilesInDirOnDisk(File1, File2, -(A_HIDDEN Or A_RDONLY)) & vbCrLf
strDisplay = strDisplay & "(R)ead-Only : " & cFilesInDirOnDisk(File1, File2, -(A_RDONLY)) & vbCrLf
strDisplay = strDisplay & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lngResult = cFilesInDirOnDisk(File1, File2, A_ALL)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileDateTime()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
strDisplay = strDisplay & "File creation for '" & File1 & "' is " & cFileDateCreated(File1) & " " & cFileTimeCreated(File1) & vbCrLf
strDisplay = strDisplay & "File last access for '" & File1 & "' is " & cFileLastDateAccess(File1) & " " & cFileLastTimeAccess(File1) & vbCrLf
strDisplay = strDisplay & "File last modification for '" & File1 & "' is " & cFileLastDateModified(File1) & " " & cFileLastTimeModified(File1) & vbCrLf & vbCrLf
File1 = "c:\config.sys"
strDisplay = strDisplay & "File creation for '" & File1 & "' is " & cFileDateCreated(File1) & " " & cFileTimeCreated(File1) & vbCrLf
strDisplay = strDisplay & "File last access for '" & File1 & "' is " & cFileLastDateAccess(File1) & " " & cFileLastTimeAccess(File1) & vbCrLf
strDisplay = strDisplay & "File last modification for '" & File1 & "' is " & cFileLastDateModified(File1) & " " & cFileLastTimeModified(File1) & vbCrLf & vbCrLf
File1 = cGetSystemDirectory() + "\t2win-32.dll"
strDisplay = strDisplay & "File creation for '" & File1 & "' is " & cFileDateCreated(File1) & " " & cFileTimeCreated(File1) & vbCrLf
strDisplay = strDisplay & "File last access for '" & File1 & "' is " & cFileLastDateAccess(File1) & " " & cFileLastTimeAccess(File1) & vbCrLf
strDisplay = strDisplay & "File last modification for '" & File1 & "' is " & cFileLastDateModified(File1) & " " & cFileLastTimeModified(File1) & vbCrLf & vbCrLf
File1 = cGetWindowsDirectory() + "\user.dat"
strDisplay = strDisplay & "File creation for '" & File1 & "' is " & cFileDateCreated(File1) & " " & cFileTimeCreated(File1) & vbCrLf
strDisplay = strDisplay & "File last access for '" & File1 & "' is " & cFileLastDateAccess(File1) & " " & cFileLastTimeAccess(File1) & vbCrLf
strDisplay = strDisplay & "File last modification for '" & File1 & "' is " & cFileLastDateModified(File1) & " " & cFileLastTimeModified(File1) & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
strResult = cFileDateCreated(File1)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileStatistics()
Dim lngResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim nL As Long
Dim nW As Long
Dim nC As Long
Dim File1 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
strDisplay = strDisplay & "File statictics for '" & File1 & "' is " & cFileStatistics(File1, nL, nW, nC) & vbCrLf
strDisplay = strDisplay & "number of lines : " & nL & vbCrLf
strDisplay = strDisplay & "number of words : " & nW & vbCrLf
strDisplay = strDisplay & "number of chars : " & nC & vbCrLf & vbCrLf
File1 = "c:\config.sys"
strDisplay = strDisplay & "File statictics for '" & File1 & "' is " & cFileStatistics(File1, nL, nW, nC) & vbCrLf
strDisplay = strDisplay & "number of lines : " & nL & vbCrLf
strDisplay = strDisplay & "number of words : " & nW & vbCrLf
strDisplay = strDisplay & "number of chars : " & nC & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lngResult = cFileStatistics(File1, nL, nW, nC)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestGetDriveType()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
strResult = ""
strDisplay = ""
For i = 1 To 26
intResult = cGetDriveType(Chr$(64 + i))
If (intResult > 0) Then
strDisplay = strDisplay & "'" & Chr$(64 + i) & ":' is "
Select Case intResult
Case DRIVE_UNKNOWN
strDisplay = strDisplay & "(unknown)" & vbCrLf
Case DRIVE_NO_ROOT_DIR
strDisplay = strDisplay & "(not root dir)" & vbCrLf
Case DRIVE_REMOVABLE
strDisplay = strDisplay & "removable" & vbCrLf
Case DRIVE_FIXED
strDisplay = strDisplay & "fixed disk" & vbCrLf
Case DRIVE_REMOTE
strDisplay = strDisplay & "remote disk" & vbCrLf
Case DRIVE_CDROM
strDisplay = strDisplay & "cd-rom" & vbCrLf
Case DRIVE_RAMDISK
strDisplay = strDisplay & "ram disk" & vbCrLf
End Select
End If
Next i
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cGetDriveType("C")
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestPBFileCopy()
Dim intResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim File1 As String
Dim File2 As String
strResult = ""
strDisplay = ""
File1 = cGetWindowsDirectory() + "\" + "system.dat"
File2 = "system.pbcopy"
strDisplay = strDisplay & "PB File Copy '" & File1 & "' to '" & File2 & "' is " & cPBFileCopy(Me.hWnd, File1, File2) & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
DoEvents
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cPBFileCopy(Me.hWnd, File1, File2)
DoEvents
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestDBFileCopy()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim File1 As String
Dim File2 As String
strResult = ""
strDisplay = ""
File1 = cGetWindowsDirectory() + "\" + "system.dat"
File2 = "system.dbcopy"
strDisplay = strDisplay & "DB File Copy '" & File1 & "' to '" & File2 & "' is " & cDBFileCopy("", "", "", "", File1, File2) & vbCrLf & vbCrLf
File1 = cGetWindowsDirectory() + "\" + "command.com"
File2 = "command.dbcopy"
strDisplay = strDisplay & "DB File Copy '" & File1 & "' to '" & File2 & "' is " & cDBFileCopy("", "", "", "", File1, File2) & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
DoEvents
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cDBFileCopy("", "", "", "", File1, File2)
DoEvents
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileUUCP()
Dim lngResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
Dim File2 As String
Dim File3 As String
strResult = ""
strDisplay = ""
File1 = "c:\win95\system.dat"
File2 = "system.uuencoded"
File3 = "system.uudecoded"
strDisplay = strDisplay & "File UUencode '" & File1 & "' to '" & File2 & "' is " & cFileUUCP(File1, File2, MODE_UUENCODE) & vbCrLf
strDisplay = strDisplay & "File UUdecode '" & File2 & "' to '" & File3 & "' is " & cFileUUCP(File2, File3, MODE_UUDECODE) & vbCrLf
strDisplay = strDisplay & "Compare File contents (not sensitive) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
File1 = T2WFileTest
File2 = "autoexec.uuencoded"
File3 = "autoexec.uudecoded"
strDisplay = strDisplay & "File UUencode '" & File1 & "' to '" & File2 & "' is " & cFileUUCP(File1, File2, MODE_UUENCODE) & vbCrLf
strDisplay = strDisplay & "File UUdecode '" & File2 & "' to '" & File3 & "' is " & cFileUUCP(File2, File3, MODE_UUDECODE) & vbCrLf
strDisplay = strDisplay & "Compare File contents (not sensitive) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lngResult = cFileUUCP(File1, File2, MODE_UUENCODE)
Next i
lngResult = cFileUUCP(File2, File3, MODE_UUDECODE)
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub